package com.xinqi.common.core.utils;

import java.util.regex.Pattern;

public class PatternUtils {

    /*邮箱验证*/
    public static String emailRegexPattern = "^(.+)@(\\S+)$";

    public static boolean patternMatches(String emailAddress, String regexPattern) {
        return Pattern.compile(regexPattern)
            .matcher(emailAddress)
            .matches();
    }

    /*文本只包含数字和字母*/
    public static boolean isAlphaNumeric(String s) {
        // 判断字符串只包含数字和字母
        String reg = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,18}$";
        return s.matches(reg);
    }

}
